package com.lixiaoyi.emp.controller;

import com.lixiaoyi.emp.service.IEmpService;
import com.lixiaoyi.emp.service.impl.EmpServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author 李小毅
 * @Description
 * @Date 2022-05-12
 */
@WebServlet("/manager/safe/removeEmpController")
public class RemoveEmpController extends HttpServlet {

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


        Integer id = Integer.valueOf(request.getParameter("id"));
        IEmpService empService = new EmpServiceImpl();

        empService.removeEmp(id);

        response.sendRedirect(request.getContextPath() + "/manager/safe/showAllEmpController");
        //System.out.println(id);

    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        doPost(request,response);
    }
}
